using System;
using System.ComponentModel;
using System.Xml.Serialization;

namespace com.exceptionalsoftware.spacetime.KML
{
	
	[Serializable()]
	[XmlType(TypeName = "LinkType")]
    [XmlInclude(typeof(Icon))]
	public class Link : ObjectType
	{
		private float refreshIntervalField, viewRefreshTimeField, viewBoundScaleField;
        private string hrefField, viewFormatField, httpQueryField;
        private ViewRefreshModeEnum viewRefreshModeField;
        private RefreshModeEnum refreshModeField;
		
		public Link()
		{
            this.viewRefreshTimeField = 4F;
            this.viewBoundScaleField = 1F;
            this.viewRefreshModeField = ViewRefreshModeEnum.Never;
            this.refreshModeField = RefreshModeEnum.OnChange;
		}

		[XmlElement(ElementName = "href", DataType = "string")]
		public string Href
		{
			get { return this.hrefField; }
            set { this.hrefField = value; }
		}

        [XmlElement(ElementName = "viewFormat", DataType = "string")]
        public string ViewFormat
        {
            get { return this.viewFormatField; }
            set { this.viewFormatField = value; }
        }

        [XmlElement(ElementName = "httpQuery", DataType = "string")]
        public string HttpQuery
        {
            get { return this.httpQueryField; }
            set { this.httpQueryField = value; }
        }

        [XmlElement(ElementName = "refreshInterval", DataType = "float")]
        public float RefreshInterval
        {
            get { return this.refreshIntervalField; }
            set { this.refreshIntervalField = value; }
        }

        [XmlElement(ElementName = "viewRefreshTime", DataType = "float")]
        [DefaultValue(4F)]
        public float ViewRefreshTime
        {
            get { return this.viewRefreshTimeField; }
            set { this.viewRefreshTimeField = value; }
        }

        [XmlElement(ElementName = "viewBoundScale", DataType = "float")]
        [DefaultValue(1F)]
        public float ViewBoundScale
        {
            get { return this.viewBoundScaleField; }
            set { this.viewBoundScaleField = value; }
        }

        [XmlElement(ElementName = "refreshMode", Type = typeof(RefreshModeEnum))]
        [DefaultValue(RefreshModeEnum.OnChange)]
        public RefreshModeEnum RefreshMode
        {
            get { return this.refreshModeField; }
            set { this.refreshModeField = value; }
        }

        [XmlElement(ElementName = "viewRefreshMode", Type = typeof(ViewRefreshModeEnum))]
        [DefaultValue(ViewRefreshModeEnum.Never)]
        public ViewRefreshModeEnum ViewRefreshMode
        {
            get { return this.viewRefreshModeField; }
            set { this.viewRefreshModeField = value; }
        }
    }
    [Serializable()]
    [XmlType(TypeName = "refreshModeEnum")]
    public enum RefreshModeEnum
    {
        [XmlEnum(Name = "onChange")]
        OnChange,

        [XmlEnum(Name = "onInterval")]
        OnInterval,

        [XmlEnum(Name = "onExpire")]
        OnExpire
    }

    [Serializable()]
    [XmlType(TypeName = "viewRefreshModeEnum")]
    public enum ViewRefreshModeEnum
    {
        [XmlEnum(Name = "never")]
        Never,

        [XmlEnum(Name = "onRequest")]
        OnRequest,

        [XmlEnum(Name = "onStop")]
        OnStop,

        [XmlEnum(Name = "onRegion")]
        OnRegion
    }
}